/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.iftk.xmlparser.domain;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 *
 * @author treiman
 */
public class Period {
    private int periodNumber;
    private int startDay;
    private int endDay;
    private int startMonth;
    private int endMonth;
    private int startYear;
    private int endYear;

    private Calendar begin;
    private Calendar end;
    
    public Period() {
        begin = Calendar.getInstance();
        end = Calendar.getInstance();
    }

    public Calendar getBegin() {
        return begin;
    }

    public void setBegin(Calendar begin) {
        this.begin = begin;
    }

    public Calendar getEnd() {
        return end;
    }

    public void setEnd(Calendar end) {
        this.end = end;
    }
    
    public int getPeriodNumber() {
        return periodNumber;
    }

    public void setPeriodNumber(int periodNumber) {
        this.periodNumber = periodNumber;
    }

    public int getEndDay() {
        return endDay;
    }

    public void setEndDay(int endDay) {
        this.endDay = endDay;
    }

    public int getEndMonth() {
        return endMonth;
    }

    public void setEndMonth(int endMonth) {
        this.endMonth = endMonth;
    }

    public int getEndYear() {
        return endYear;
    }

    public void setEndYear(int endYear) {
        this.endYear = endYear;
    }

    public int getStartDay() {
        return startDay;
    }

    public void setStartDay(int startDay) {
        this.startDay = startDay;
    }

    public int getStartMonth() {
        return startMonth;
    }

    public void setStartMonth(int startMonth) {
        this.startMonth = startMonth;
    }

    public int getStartYear() {
        return startYear;
    }

    public void setStartYear(int startYear) {
        this.startYear = startYear;
    }
    
    @Override public String toString() {
        DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
        StringBuilder result = new StringBuilder();
        String NEW_LINE = System.getProperty("line.separator");

        result.append(" Period: ").append(periodNumber).append(NEW_LINE);
        result.append(" Start Date: ").append(dateFormat.format(begin.getTime())).append(NEW_LINE);
        result.append(" End Date: ").append(dateFormat.format(end.getTime())).append(NEW_LINE);
        result.append("}");

        return result.toString();
    }    
}
